home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15091 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  863 b 

  1. Path: news.production.compuserve.com!news
  2. From: Alan Huff <74312.2300@CompuServe.COM>
  3. Newsgroups: comp.lang.c++
  4. Subject: The STL and nested structures
  5. Date: 3 Apr 1996 16:42:47 GMT
  6. Organization: Motorola Lexicus
  7. Message-ID: <4ju9q7$fa1$1@mhadg.production.compuserve.com>
  8.  
  9. I am having a problem using the STL with structures defined within 
  10. a class definition.  Consider the following code fragment.
  11.  
  12. >#include <vector.h>
  13. >class Bar {
  14. >   struct Foo {
  15. >      int   value;
  16. >   };
  17. >
  18. >   vector< Foo > fooContainer;
  19. >}
  20.  
  21. The compiler I am using (VC 4.1) refuses to compile.  An error is 
  22. generated the says "'Foo' : undeclared identifier" at line 75 in 
  23. vector.h.
  24.  
  25. Line 75 of vector.h
  26. >   vector(size_type n, const T& value = T()) { ...
  27.  
  28. If I move the structure Foo out of the class and into the global 
  29. namespace there are no compilation errors.
  30.  
  31. What am I missing??
  32.